import com.yanjingzheng.entity.AndExpression;
import com.yanjingzheng.entity.Expression;
import com.yanjingzheng.entity.OrExpression;
import com.yanjingzheng.entity.TerminalExpression;

/**
 * @Author Yenchingcheng
 * @Date 2023/9/11 16:40
 * @Description
 **/
public class Main {

    //规则，john和mike是男性
    public static Expression getMaleExpression(){
        Expression expression1 = new TerminalExpression("John");
        Expression expression2 = new TerminalExpression("Mike");
        return new OrExpression(expression1,expression2);
    }

    //规则，Julie是一个已婚的女性
    public static Expression getMarriedFemaleExpression(){
        Expression expression1 = new TerminalExpression("Julie");
        Expression expression2 = new TerminalExpression("Married");
        return new AndExpression(expression1,expression2);
    }

    public static void main(String[] args) {
        Expression isMale = getMaleExpression();
        Expression isMarriedFemale = getMarriedFemaleExpression();

        System.out.println("John is male?" + isMale.interpret("John"));
        System.out.println("Julie is a married women?" + isMarriedFemale.interpret("Married Julie"));
    }
}
